<!DOCTYPE html>
<html>
<head>
    <title>校园破冰交友与失物招领平台-注册</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" type="text/css" href="../assets/css/login.css"/>
    <link rel="stylesheet" type="text/css" href="../assets/css/bootstrap.min.css"/>
</head>
<body>
<div class="agileits-main">
    <div class="header-main">
        <h2>校园破冰交友与失物招领平台</h2>
        <div class="header-bottom">
            <div class="header-right w3agile">
                <div class="header-left-bottom agileinfo">
                    <form>
                        <div class="icon1">
                            <input type="text" placeholder="学号，职工号(必填)4-12位" id="username"/>
                        </div>
                        <div class="icon1">
                            <input type="password" placeholder="密码(必填)6-18位" id="password"/>
                        </div>
                        <div class="bottom">
                            <input type="button" value="注册" id="sure"/>
                        </div>
                        <p><a href="login.html">登录</a></p>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="copyright w3-agile">
    <p>Copyright © 2019 黄胜瑾</p>
</div>
<script src="../assets/js/jquery-min.js"></script>
<script src="../assets/js/bootstrap.min.js"></script>
<script src="../assets/js/main.js"></script>
<script src="../assets/js/jquery.bootstrap-growl.js"></script>
<script>
    $(function () {
        $("#sure").click(function () {
            var username = $("#username").val();
            var password = $("#password").val();
            if(username===""||password===""||username.length<4||username.length>12||password.length<6||password.length>18){
                $.bootstrapGrowl("信息填写不规范");
                return;
            }
            $.ajax({
                type: "post",
                url: ctx + "/user/register",
                data: {username:$("#username").val(),password:$("#password").val()},
                success: function (data) {
                    alert(data);
                    window.location.href="login.html";
                }
            })
        })
    })
</script>
</body>
</html>